#pragma once
#include "stdafx.h"
#include "ui_trend_param_list.h"
#include "units.h"
#include "parameters_model.h"
#include "scene.h"
#include "sensor.h"
#include "common.h"
class Units;
class SceneView;
class Sensor;
class Common;

class TrendParamList : public QDialog
{
	Q_OBJECT
private:
	Ui::TrendParamListDialog ui;
	vector<QCheckBox *> check;
	vector<QComboBox *> item;
	vector<QComboBox *> parameter;
	vector<QComboBox *> unit;
	void add_row(const bool &_checked, automaticItem *_item, const QString &_parameter, const QString &_unit);
	//void update_item(const int &index, const QString &_item_name);
	void update_parameter(const int &index, const QString &_item_name);
	void update_unit(const int &index, const QString &_parameter_name);
	QStringList itemList;
	bool isTrend;
	SceneView *scene;
	QSignalMapper* signalMapper;
public:
	TrendParamList(QWidget* pwgt = 0);
	void setData(SceneView *_scene, vector<Common::trend_param>* param_list);
	vector<Common::trend_param> getData();
	bool typeisTrend(){ return isTrend; }
	void update_cmb(QComboBox *cmb, const QStringList &list, const QString &current_text = "");
private slots:
	void on_btnTrend_clicked();
	void on_btnCSV_clicked();
	void on_btnReject_clicked();
	void on_bAdd_clicked();
	void on_cbAllParameters_changed(int value);
	void on_check_changed(int value);
	void update_item();
	void cell_changed(const QString &data);
};
